package com.lei.springbootpractice.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lei.springbootpractice.pojo.CategoryPojo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryDao extends BaseMapper<CategoryPojo> {
    
    @Select("SELECT * FROM Category WHERE Cat_category_id IS NULL")
    List<CategoryPojo> selectParentCategories();

    @Select("SELECT * FROM Category WHERE Cat_category_id = #{parentId}")
    List<CategoryPojo> selectSubcategories(String parentId);
}
